using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Game0verUI : MonoBehaviour
{
    private Animator anim;

    private int starCount = 0;//星星个数

    public GameObject failpig;//失败的猪头
    
    public StarUI starUI1;
    public StarUI starUI2;
    public StarUI starUI3;

    private void Awake()
    {
        anim = GetComponent<Animator>();
    }

    public void Show(int starCount)
    {
        anim.SetTrigger("IsShow");
        this.starCount = starCount;
    }

    public void ShowStar()
    {
        //如果星星个数为0，则现实猪头
        if (starCount == 0)
        {
            failpig.SetActive(true);
        }
        //显示星星
        if (starCount >= 1)
        {
            starUI1.ShowStar();
        }
        if (starCount >= 2)
        {
            starUI2.ShowStar();
        }
        if (starCount >= 3)
        {
            starUI3.ShowStar();
        }
    }
    
    public void OnRestartButtonClick()
    {
        GameManager.Instance.RestartLevel();
    }

    public void OnLevelListButtonClick()
    {
        GameManager.Instance.LevelList();
    }
}
